﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TimKiemNangCao.aspx.cs" Inherits="WebHousingInfo.TimKiemNangCao" %>
<%@ Register Src="~/Controls/Header.ascx" TagName="Head" TagPrefix="Header" %>
<%@ Register Src="~/Controls/MenuFooter.ascx" TagName="MeNuDuoi" TagPrefix="MenuFooter" %>
<%@ Register Src="~/Controls/Footer.ascx" TagName="Foot" TagPrefix="Footer" %>
<%@ Register Src="~/Controls/QuangCaoTren.ascx" TagName="QCT" TagPrefix="QuangCaoTren" %>
<%@ Register Src="~/Controls/DanhMucNhaChoThue.ascx" TagName="CT" TagPrefix="DanhMucNhaChoThue" %>
<%@ Register Src="~/Controls/KhongGianSong.ascx" TagName="KGS" TagPrefix="KhongGianSong" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>Tìm kiếm nâng cao</title>
</head>
<body>
    <form id="form1" runat="server">
        <div id="uni_wrapper">
        <Header:Head ID="Header" runat="server" />
            <div id="uni_main">
             <!-- E_Header Navigation Menu --> 
	            <div id="content" class="clearfix">
		            <div id="group_750_l">				            
				        <div id="box_timkiem">
					        <div class="title_tk"><b>T&igrave;m ki&#7871;m n&acirc;ng cao</b></div>
					        <div class="content_tk">
							        <table border="0" cellpadding="0" cellspacing="5">
								        <tr>
									        <td class="td1">Loại hình tìm kiếm<td class="space">:</td></td>
									        <td class="td2">									        
                                                <asp:DropDownList ID="dlcategory" class="ch_select" DataTextField="Value" DataValueField="Key" runat="server">
                                                </asp:DropDownList>
									        </td>
								        </tr>
								        <tr>
									        <td class="td1">Quận/Huyện<td class="space">:</td></td>
									        <td class="td2">
										        <asp:DropDownList ID="dlareas" class="ch_select" DataTextField="Value" 
                                                    AutoPostBack="true" DataValueField="Key" runat="server" onselectedindexchanged="dlareas_SelectedIndexChanged" >
                                                </asp:DropDownList>
									        </td>
									        <td align="right" style="width:auto;" >Đường<td class="space">:</td></td>
									        <td>
										        <asp:DropDownList ID="dlareasdetail" Width="145px" DataTextField="Value" DataValueField="Key" class="ch_select" runat="server">
                                                </asp:DropDownList>
									        </td>
								        </tr>
								        <tr>
									        <td class="td1">Loại hình BĐS<td class="space">:</td></td>
									        <td class="td2">
										        <asp:DropDownList ID="dlhousetype" DataTextField="Value" DataValueField="Key" class="ch_select" runat="server">
                                                </asp:DropDownList>
									        </td>
								        </tr>
								        <tr>
									        <td class="td1">Tổng diện tích<td class="space">:</td></td>
									        <td class="td2">
										        <asp:DropDownList ID="dlsure" class="ch_select" DataTextField="Value" DataValueField="Key" runat="server">
										            <asp:ListItem Value="all">Tất cả</asp:ListItem>
										            <asp:ListItem Value="0-50">&lt; 50 m2</asp:ListItem>
										            <asp:ListItem Value="50-100">50 m2 - 100 m2</asp:ListItem>
										            <asp:ListItem Value="100-150">100 m2 - 150 m2</asp:ListItem>
										            <asp:ListItem Value="150-200">150 m2 - 200 m2</asp:ListItem>
										            <asp:ListItem Value="200-300">200 m2 - 300 m2</asp:ListItem>
										            <asp:ListItem Value="300-500">300 m2 - 500 m2</asp:ListItem>
										            <asp:ListItem Value="500">&gt; 500 m2</asp:ListItem>
                                                </asp:DropDownList>
									        </td>
								        </tr>
								        <tr>
									        <td class="td1">Giá tiền<td class="space">:</td></td>
									        <td class="td2">
										        <span  id="lbl_price" style="display:">
											        <asp:DropDownList ID="dlprice" class="ch_select" DataTextField="Value" DataValueField="Key" runat="server">
											            <asp:ListItem Value="thuongluong">------Thương lượng-----</asp:ListItem>
                                                        <asp:ListItem Value="1-150000000">&lt; 150 triệu</asp:ListItem>
                                                        <asp:ListItem Value="150000000-300000000">150 triệu - 300 triệu</asp:ListItem>
                                                        <asp:ListItem Value="300000000-600000000">300 triệu - 600 triệu</asp:ListItem>
                                                        <asp:ListItem Value="600000000-1000000000">600 triệu- 1 tỷ</asp:ListItem>
                                                        <asp:ListItem Value="1000000000-2000000000">1 tỷ - 2 tỷ</asp:ListItem>
                                                        <asp:ListItem Value="3000000000">&gt; 3 tỷ</asp:ListItem>
                                                    </asp:DropDownList>
										        </span>								
                                                <asp:CheckBox ID="cbsupm" class="margin_right" runat="server" />
										        <span class="dvi">&nbsp;/m<sup>2</sup></span>
									        </td>
									        <td align="right" style="width:auto; width:45px;" >Loại tiền<td class="space">:</td></td>
									        <td>
										        <asp:DropDownList ID="dlcurrency" Width="145px" class="ch_select" DataTextField="Value" DataValueField="Key" runat="server">
                                                </asp:DropDownList>
									        </td>
								        </tr>
								        <tr>
									        <td class="td1">Hướng<td class="space">:</td></td>
									        <td class="td2">
										        <asp:DropDownList ID="dldirection" class="ch_select" DataTextField="Value" DataValueField="Key" runat="server">
                                                    <asp:ListItem>Tất cả</asp:ListItem>
										            <asp:ListItem>Bắc</asp:ListItem>
                                                    <asp:ListItem>Đông</asp:ListItem>
                                                    <asp:ListItem>Đông bắc</asp:ListItem>
                                                    <asp:ListItem>Đông nam</asp:ListItem>
                                                    <asp:ListItem>Nam</asp:ListItem>
                                                    <asp:ListItem>Tây</asp:ListItem>
                                                    <asp:ListItem>Tây bắc</asp:ListItem>
                                                    <asp:ListItem>Tây nam</asp:ListItem>
                                                    <asp:ListItem>Khác</asp:ListItem>
                                                </asp:DropDownList>
									        </td>
								        </tr>
								        <tr>
									        <td class="td1">Giấy tờ<td class="space">:</td></td>
									        <td class="td2">
										        <asp:DropDownList ID="dldocument" class="ch_select" DataTextField="Value" DataValueField="Key" runat="server">
										            <asp:ListItem>Tất cả</asp:ListItem>
                                                    <asp:ListItem>Sổ Đỏ</asp:ListItem>
                                                    <asp:ListItem>Sổ Hồng</asp:ListItem>
                                                    <asp:ListItem>Giấy Tay</asp:ListItem>
                                                </asp:DropDownList>
									        </td>
								        </tr>
								        <tr>
									        <td class="td1">Sắp xếp kết quả theo<td class="space">:</td></td>
									        <td class="td2">
										        <asp:DropDownList ID="dlsort" class="ch_select" DataTextField="Value" DataValueField="Key" runat="server">
										            <asp:ListItem Value="CREATEDATE">Theo ngày đăng mới nhất</asp:ListItem>
                                                    <asp:ListItem Value="SURFACEAREAMAX">Theo diện tích lớn nhất</asp:ListItem>
                                                    <asp:ListItem Value="SURFACEAREAMIN">Theo diện tích bé nhất</asp:ListItem>
                                                    <asp:ListItem Value="PRICEMAX">Theo giá tiền lớn nhất</asp:ListItem>
                                                    <asp:ListItem Value="PRICEMIN">Theo giá tiền bé nhất</asp:ListItem>
                                                    <asp:ListItem Value="VIEWMAX">Theo lượt xem nhiều</asp:ListItem>
                                                </asp:DropDownList>
									        </td>
								        </tr>
								        <tr>
									        <td class="td1">Từ khoá bất kỳ<td class="space">:</td></td>
									        <td class="td2">										        
                                                <asp:TextBox ID="txtanykey" MaxLength="50" Width="277px" class="ch_select" runat="server"></asp:TextBox>
									        </td>
								        </tr>
							        </table>
							        <br class="clear" />
							        <span class="btn_footer" style="text-align:right; height:25px;">
                                            <asp:Button ID="btnsearchadvaned" class="button01_searchadvaned" runat="server" 
                                                Text="Tìm kiếm" onclick="btnsearchadvaned_Click" /></span>
					        </div>
				        </div>                      
			            <div id="ketquatimkiem" class="clearfix">
				            <div class="title_ketquatimkiem">
					            <p style="text-transform:uppercase">
						            Kết quả tìm kiếm
					            </p>
				            </div>
				            <% var obNewstin = ReturnListSearch(); %>
				            <div class="content">
					            <div id="show01">Kết quả : 1 - 10 trong số <% if (obNewstin != null)
                                                               { %><%=obNewstin.Count%><%}
                                                               else
                                                               { %>0<%} %> tin</div>
					            <div id="show02">Sắp xếp theo:
						            <asp:DropDownList Width="122px" ID="dlsapxep" AutoPostBack="true" 
                                        runat="server" onselectedindexchanged="dlsapxep_SelectedIndexChanged">
                                        <asp:ListItem Value="ngaydang">Ngày đăng mới nhất</asp:ListItem>
                                        <asp:ListItem Value="xemnhieu">Lượt Xem Nhiều Nhất</asp:ListItem>
                                        <asp:ListItem Value="giamax">Giá cao đến thấp</asp:ListItem>
                                        <asp:ListItem Value="giamin">Giá thấp đến cao</asp:ListItem>
                                    </asp:DropDownList>
					            </div>
				            </div>
			            </div>
		              <!-- e ket qua tim kiem-->
		              <%if (obNewstin != null)
                  {
                      if (obNewstin.Count > 0)
                      { %>
			             <div id="menu_timkiem">	
				            <div class="bg">
					            <ul>
						            <li style="width:100px;">Hình ảnh</li>
						            <li style="width:168px;">Thông Tin</li>
						            <li class="right" style="width:98px;">Ngày Đăng</li>
						            <li class="right" style="width:87px;">Nơi Đăng</li>
					            </ul>
				            </div> 
			             </div> 
			              <%}
                  } %> 
			            
			              <%
                  if (obNewstin != null)
                  {
                      int cout = 0;
                      foreach (var obNewsHouse in obNewstin)
                      {
                          cout += 1;
                             %>
                            <div id="data_group_width_748">
                            <%if (cout < obNewstin.Count)
                              { %>
			                    <div class="sub_data_group_width_748">
			                <%}
                              else
                              { %>
			                    <div class="sub_data_group_width_748" style="margin-bottom:0px;">
			                <%} %>
				                    <div class="img_width_100">
				                    <% if (obNewsHouse.UrlImage != "")
                        {
                            var listimage = obNewsHouse.UrlImage.Split('/');
                            string url = "";
                            foreach (var detail in listimage)
                            {
                                if (checkurlimage(detail) == true)
                                {
                                    url = "TotalUpload/ImagesTotal/" + detail;                                    
                                                        
                                                    
                                                 %><a href="TinNhaDatChiTiet.aspx?id=<%=obNewsHouse.NewsHouseID %>"><img src="<%=url %>" width="100px" height="100px" border="0" align="left" /></a><% break;
                                }
                            }
                            if (url == "")
                            { %><a href="TinNhaDatChiTiet.aspx?id=<%=obNewsHouse.NewsHouseID %>"><img src="TotalUpload/ImagesTotal/noimage.gif" width="100px" height="100px" border="0" align="left" /></a>
                                        <% }
                        }
                        else
                        { %>
                                        <a href="TinNhaDatChiTiet.aspx?id=<%=obNewsHouse.NewsHouseID %>"><img src="TotalUpload/ImagesTotal/noimage.gif" width="100px" height="100px" border="0" align="left" /></a>
                                    <%} %></div>
				                    <div class="right_width_647">
					                    <div class="title_group_width_647">
						                    <span class="sub_title_left"><a href="TinNhaDatChiTiet.aspx?id=<%=obNewsHouse.NewsHouseID %>"><%=obNewsHouse.Title%></a></span>
						                    <span class="sub_title_right"><a href="TinNhaDatChiTiet.aspx?id=<%=obNewsHouse.NewsHouseID %>">chi tiết</a></span>
					                    </div>
					                    <div class="content_group_width_647">
						                    <table width="647" border="0" cellspacing="0" cellpadding="0">						
							                    <tr>
								                    <td valign="top" class="li_width_126" width="120"  bgcolor="#FFFFFF">
									                    <div class="li_width_126_01">
										                    Giá: <span class="spannormal"><%=obNewsHouse.Price%> <%=obNewsHouse.CurrencyName%></span><br>DT: <% if (obNewsHouse.SurfaceAreaHeight == obNewsHouse.SurfaceAreaWidth)
                                                                                                                               { %><%=obNewsHouse.SurfaceAreaWidth%> m<sup>2</sup> <%} %> <%else
                        { %><%=obNewsHouse.SurfaceAreaWidth%> x <%=obNewsHouse.SurfaceAreaHeight%> (m x m)<%} %> <br />Vị trí: <%=obNewsHouse.AreaDetailName%><br>	
									                    </div>
								                    </td>
								                    <td valign="top" bgcolor="#FFFFFF" class="li_width_336">
									                    <div class="li_width_336_01" align="justify">
										                    <% if (obNewsHouse.NewsContent.Length > 200)
                              {%>
                                                            <%=obNewsHouse.NewsContent.Substring(0, 199)%> ...
                                                        <%}
                              else
                              {%>
                                                         <%=obNewsHouse.NewsContent%>
                                                        <%} %><br />
										                    <span class="spannormal">Lượt xem: <b><%=obNewsHouse.ViewCount%></b>  |  								
											                    <span>
												                    <a href="Ketquatimkiem.aspx?save=<%=obNewsHouse.NewsHouseID %>">Lưu tin</a>
											                    </span>
										                    </span>
									                    </div>
								                    </td>
								                    <td valign="top" bgcolor="#FFFFFF" class="li_width_88">
									                    <div class="li_width_88_01">
									                        <%=obNewsHouse.AreaDetailName%><br />
											                <%=obNewsHouse.AreaName%><br />Đà Nẵng			
									                     </div>
								                    </td>
								                    <td valign="top" class="li_width_97">
									                    <div class="li_width_97_01">
									                        <%=obNewsHouse.CreatedDate.ToShortDateString()%>
									                    </div>
								                    </td>
							                    </tr>
						                    </table>																	
					                    </div>
				                    </div>
			                    </div>					                    																
		                    </div>
                            <%
                      }%>
                      <%if(obNewstin.Count > 0){ %>
                        <div id="link">
			                <ul>
				                <li class="disable_link"><a>&laquo; Trở về</a></li>
				                <li class="select"><a>1</a></li>
				                <li><a href="#"><strong>2</strong></a></li>
			                </ul>
		                </div>
		                <%} %>
                  <%}%>  
		            </div>
		            <div id="group_5">
			           <DanhMucNhaChoThue:CT ID="DanhMucNhaChoThue" runat="server" />
			            <KhongGianSong:KGS ID="KhongGianSong" runat="server" />
		            </div>
	            <!--E_menu-->
	            </div>	
            </div>
            <MenuFooter:MeNuDuoi ID="MenuFooter" runat="server" />
            <Footer:Foot ID="Footer" runat="server" />
         </div>
    </form>
</body>
</html>